home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / LDB171.ARJ / EXAMP301.CPP < prev    next >
Text File  |  1992-05-12  |  856b  |  35 lines

  1.      // examp301.cpp - link with binder.obj
  2.  
  3.      #include <string.h>
  4.      #include "binder.hpp"
  5.  
  6.      char *v[] = {
  7.           "Vectors can be",
  8.           "'exploded' into Binders",
  9.           "sorted and then",
  10.           "'imploded' back to vectors!", 
  11.           0
  12.      };
  13.  
  14.      main()
  15.      {
  16.           Binder b ((voiDV) v);  // explode constructor
  17.  
  18.           cout << "\n\nExploded, unsorted vector ...\n\n";
  19.           for (unsigned i = 0; b[i]; i++)
  20.                cout << (char *) b[i] << "\n";
  21.  
  22.           b.sort ((BDRcomP) strcmp);    // sort
  23.           char **sV = (char **) b.vector();  // implode
  24.  
  25.           if (!sV)  return 1;
  26.  
  27.           cout << "\n\nImploded, sorted vector ... \n\n";
  28.           for (i = 0; sV[i]; i++)  
  29.                     cout << sV[i] << "\n";
  30.  
  31.           delete sV;
  32.  
  33.           return 0;
  34.      }
  35.